home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / net / netware / nwserv.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-20  |  25.0 KB  |  823 lines

  1. {$X+,V-,B-}
  2. UNIT nwServ;
  3.  
  4. INTERFACE
  5.  
  6. uses NwMisc,nwConn;
  7.  
  8. Var result:word;
  9.  
  10. { Primary Functions:                      Interrupt: Comments:
  11.  
  12. * CheckConsolePrivileges                  (F217/C8)
  13. * ClearConnectionNumber                   (F217/D2)
  14. * DisableFileServerLogin                  (F217/CB)
  15.   DisableTransactionTracking              (F217/CF)
  16. * DownFileServer                          (F217/D3) (3)
  17. * EnableFileServerLogin                   (F217/CC)
  18.   EnableTransactionTracking               (F217/D0)
  19.   GetBinderyObjectDiskSpaceLeft           (F217/E6)
  20.   GetConnectionsOpenFiles                 (F217/DB)
  21.   GetDiskUtilization                      (F217/0E)
  22. * GetFileServerDateAndTime                (F214)
  23. * GetFileServerDescriptionStrings         (F217/C9)
  24. * GetFileserverLoginStatus                (F217/CD)
  25.   GetPathFromDirectoryEntry               (F216/1A) [E2../1A]
  26. * GetNetworkSerialNumber                  (F217/12) (2)
  27. * GetServerInformation                    (F217/11) (1)
  28. * SetFileServerDateAndTime                (F217/CA)
  29. * VerifyNetworkSerialNumber               (F217/0C) (2)
  30.  
  31.   Functions that MAY NOT be supported by NW 386:
  32.   (their F2 interfaces might work...)
  33.  
  34.   GetConnectionsTaskInformation           (F217/DA)
  35.   GetConnectionsUsageStats                (F217/E5)
  36.   GetConnectionsUsingAFile                (F217/DC)
  37.   GetDiskCacheStats                       (F217/D6)
  38.   GetDiskChannelStats                     (F217/D9)
  39.   GetDriveMappingTable                    (F217/D7)
  40.   GetFileServerLANIOStats                 (F217/E7)
  41.   GetFileSystemStats                      (F217/D4)
  42.   GetLANDriverConfigInfo                  (F217/E3)
  43.   GetLogicalRecordInformation             (F217/E0)
  44.   GetLogicalRecordsByConnection           (F217/DF)
  45.   GetPhysicalDiskStats                    (F217/D8)
  46.   GetPhysicalRecordLocksByFile            (F217/DE)
  47.   GetPhysRecLocksByConnectAndFile         (F217/DD)
  48.  
  49.  
  50.   Secondary functions:
  51.  
  52.   CheckNetwareVersion
  53.  
  54.   Not supported by netware 3.x:
  55.  
  56. - GetFileServerMiscInformation            (F217/E8) (1) (4)
  57.  
  58. Notes: The Functions marked with an - are NOT implemented in this API,
  59.        because they are not supported by NW 386.
  60.  
  61.        (1) Please don't confuse these two functions.
  62.        (2) Functions not normally supported in NW API's, but
  63.            closely related to the functions in this unit.
  64.        (3) ERROR: will down the server regardless of the ForceFlag parameter.
  65.        (4) F217/.. returns error 251: Unknown Request. Call not implemented.
  66. }
  67.  
  68.  
  69. Type TserverInfo=Record
  70.                 ServerName         : string[48];
  71.                 NetwareVersion     : Byte;
  72.                 NetwareSubVersion  : Byte; { 0..99 }
  73.                 ConnectionsMax     : word;
  74.                 ConnectionsInUse   : word;
  75.                 MaxConnVol         : word; { max connected volumes }
  76.                 {---Advanced Netware 2.1x/3.x------------}
  77.                 OS_revision        : byte;
  78.                 SFT_level          : byte;
  79.                 TTS_level          : byte;
  80.                 peak_conn_used     : word; { max simult.used connections}
  81.                 accounting_version : byte;
  82.                 vap_version        : byte;
  83.                 queuing_version               : byte;
  84.                 print_server_version          : byte;
  85.                 virtual_console_version       : byte;
  86.                 security_restrictions_level   : byte;
  87.                 Internetwork_bridge_version   : byte;
  88.                 Undefined                     : Array [1..60] of Byte;
  89.                 End;
  90.  
  91. Type TfileInfoRecord=record
  92.                      taskNbr:Byte;
  93.                      lockFlag:Byte;
  94.                      AccessFlag:Byte;
  95.                      LockType:Byte; { 00 no lock; FE file lock; FF locked by Begin Share File Set }
  96.                      volumeNbr:Byte; { 0..31 }
  97.                      DirEntry:Word;
  98.                      FileName:string[13];
  99.                      end;
  100.  
  101. {Bitfields for lock flags:
  102.  bit 0    file is locked
  103.  bit 1    file opened Shareable
  104.  bit 2    logged
  105.  bit 3    file opened Normal
  106.  bit 6    TTS holding lock
  107.  bit 7    Transaction Flag set on file
  108.  
  109. Bitfields for access flags:
  110.  bit 0    file open for reading by calling station
  111.  bit 1    file open for writing by calling station
  112.  bit 2    deny reads by other stations
  113.  bit 3    deny writes by other stations
  114.  bit 4    file detached
  115.  bit 5    TTS Holding Detach
  116.  bit 6    TTS Holding Open}
  117.  
  118.  
  119.  
  120. {F217/C8 [2.15c+]}
  121. FUNCTION CheckConsolePrivileges : Boolean;
  122.  
  123. {F217/D2 [2.15c+]}
  124. Function ClearConnectionNumber(connectionNbr:byte):boolean;
  125. { Console Rights needed;
  126.   -Terminates a connection. }
  127.  
  128. {F217/CB [2.15c+]}
  129. FUNCTION DisableFileServerLogin : Boolean;
  130.  
  131. {F217/CF [2.15c+]}
  132. FUNCTION DisableTransactionTracking : Boolean;
  133.  
  134. {F217/D3 [2.15c+]}
  135. FUNCTION DownFileServer (ForceFlag : Boolean) : Boolean;
  136.  
  137. {F217/CC [2.15c+]}
  138. FUNCTION EnableFileServerLogin : Boolean;
  139.  
  140. {F217/D0 [2.15c+]}
  141. FUNCTION EnableTransactionTracking : Boolean;
  142.  
  143. {F217/E6 [2.15c+]}
  144. FUNCTION GetBinderyObjectDiskSpaceLeft
  145.             (    ObjID : longInt;
  146.              var SystemElapsedTime,UnusedDiskBlocks : longint;
  147.              var RestrictionEnforced : Boolean             ) : Boolean;
  148.  
  149. {F217/DB [2.15c+]}
  150. FUNCTION GetConnectionsOpenFiles
  151.            ( ConnID,ConnNumber  : Byte;
  152.      {i/o:}  var LastRecordSeen : word;
  153.      {out:}  var FileInfo: TfileInfoRecord ) : Boolean;
  154. { To be called Iteratively.
  155.   LastRecordSeen is an i/o parameter;
  156.   -An initial value of 0 has to be supplied;
  157.   -The function can be called until LastRecordSeen becomes 0,
  158.    indicating the end of the FIR-list. }
  159. { normally a great number of File Information Records (FIR's) can be returned by one call.
  160.   We have changed the function so that it returns one FIR per call. }
  161. { the calling workstation must have console operator privileges. }
  162.  
  163.  
  164. {F217/0E [2.15c+]}
  165. FUNCTION GetDiskUtilization(volNbr:byte; objID:Longint;
  166.                         Var usedDirs,usedFiles,usedBlocks:Word ):Boolean;
  167.  
  168. {F214    [2.15c+]}
  169. FUNCTION GetFileServerDateAndTime ( Var time:NovTimeRec): Boolean;
  170.  
  171. {F217/C9 [2.15c+]}
  172. FUNCTION GetFileServerDescriptionStrings(Var companyName,
  173.                                              VersionAndRevision,revisionDate,
  174.                                              copyrightNotice:String
  175.                                          ):Boolean;
  176.  
  177. {F217/CD [2.15c+]}
  178. FUNCTION GetFileServerLoginStatus (Var LoginEnabled:Boolean): Boolean;
  179. { if Login is enabled then returns TRUE in LoginEnabled }
  180. { rusult byte:  00h  - Success, C6h No Console Rights }
  181. {Caller must have operator status.}
  182.  
  183.  
  184. {F216/1A [2.15c+]}
  185. FUNCTION GetPathFromDirectoryEntry(connID:word;
  186.                                    volNbr:Byte; dirEntry:word;
  187.                                Var Path:String                ):Boolean;
  188. {To be used in conjunction with the GetConnectionsOpenFiles func.}
  189.  
  190. {F217/12 [2.15c+]}
  191. Function GetNetworkSerialNumber(Var serialNbr:LongInt; Var ApplicNbr:Word ):Boolean;
  192. {return the serial number and application number for the software
  193.       installed on the file server}
  194. {SeeAlso: VerifyNetworkSerialNumber,GetServerInformation}
  195.  
  196. {F217/11 [2.15c+]}
  197. Function GetServerInformation (Var serverInfo:TserverInfo):boolean;
  198. {determine the version of software installed on the file server and how it is configured}
  199.  
  200.  
  201. {F217/CA [2.15c+]}
  202. FUNCTION SetFileServerDateAndTime(time:NovTimeRec):Boolean;
  203. {need console operator privileges to do this}
  204.  
  205. {F217/OC [2.15c+]}
  206. Function VerifyNetworkSerialNumber(serialNbr: LongInt ;
  207.                                Var ApplicNbr: Word     ):Boolean;
  208. {if the network serial number to be verified is correct, the reply
  209.       buffer will contain the corresponding application number }
  210.  
  211. {*********************** Secondary Functions ******************************}
  212.  
  213. { [1.x/2.x/3.x] }
  214. FUNCTION CheckNetwareVersion(MinimumVersion,MinimumSubVersion,
  215.                              MinimumRevision,MinimumSFT,MinimumTTS:word):Boolean;
  216.  
  217. IMPLEMENTATION{=============================================================}
  218.  
  219.  
  220. USES Dos;
  221.  
  222. Var UnitReqBuffer:array[1..576] of byte;
  223.     UnitReplyBuffer:array[1..576] of byte;
  224.     UnitRegs:registers;
  225.  
  226. Procedure F2SystemCall(subf:byte;req_size,rep_size:word);
  227. begin
  228. With UnitRegs
  229.  do begin
  230.     DS := Seg(UnitReqBuffer);  SI := Ofs(UnitReqBuffer);   CX := Req_size;
  231.     ES := Seg(UnitReplyBuffer);DI := Ofs(UnitReplyBuffer); DX := rep_size;
  232.     AH := $F2; AL := subf;
  233.     MSDOS(UnitRegs);
  234.     Result:=al;
  235.     end;
  236. end;
  237.  
  238.  
  239. {F217/D2 [2.15c+]}
  240. Function ClearConnectionNumber(connectionNbr:byte):boolean;
  241. { Console Rights needed;
  242.   -Terminates a connection. }
  243. Var req: record
  244.          len : word;
  245.          subf: byte;
  246.          _connNbr:byte;
  247.          end          ABSOLUTE UnitReqBuffer;
  248. begin
  249. With req
  250. do begin
  251.    len:=2;
  252.    subf:=$D2;
  253.    _connNbr:=connectionNbr
  254.    end;
  255. F2SystemCall($17,SizeOf(req),0);
  256. ClearConnectionNumber:=(result=0);
  257. {result codes: 00 successful; C6 No Console Rights}
  258. end;
  259.  
  260. {F214 [2.15c+]}
  261. FUNCTION GetFileServerDateAndTime ( Var time:NovTimeRec): Boolean;
  262. Var reply : NovTimeRec ABSOLUTE UnitReplyBuffer;
  263. BEGIN
  264. F2SystemCall($14,0,SizeOf(reply));
  265. time:=reply;
  266. if time.year>100 then time.year:=time.year-100;
  267. { year<80 : 21st century }
  268. getFileServerDateAndTime:=TRUE;
  269. end;
  270.  
  271.  
  272. {F217/CA [2.15c+]}
  273. FUNCTION SetFileServerDateAndTime (time:NovTimeRec): Boolean;
  274. Var req  : record
  275.            Len:word;
  276.            subF:byte;
  277.            _time:NovTimeRec
  278.            end              ABSOLUTE UnitReqBuffer;
  279. BEGIN
  280. { year<80 : 21st century }
  281. WITH req
  282. do begin
  283.    Len:=SizeOf(req)-3; { dow is no parameter }
  284.    subF:=$CA;
  285.    _time:=time;
  286.    end;
  287. F2SystemCall($17,SizeOf(req),0);
  288. SetFileServerDateAndTime:=(Result=$00);
  289. { Resulcodes: $00 Success; $C6 No Console Operator Rights }
  290. end;
  291.  
  292.  
  293. {F217/11 [2.15c+]}
  294. Function GetServerInformation (Var serverInfo:TserverInfo):boolean;
  295. {determine the version of software installed on the file server and how it is configured}
  296.  
  297. {SeeAlso: GetDiskUtilization, GetNetworkSerialNumber, GetFileServerLoginStatus,
  298.           GetFileServerDateAndTime}
  299.  
  300. Var  Request: Record
  301.               Len  : word;
  302.               SubF : Byte;
  303.               End         ABSOLUTE UnitReqBuffer;
  304.      Reply: TserverInfo   ABSOLUTE UnitReplyBuffer;
  305.      t:word;
  306. Begin
  307. With Request
  308. Do Begin
  309.    Len := 1;
  310.    SubF:= $11;
  311.    End;
  312. F2SystemCall($17,SizeOf(request),SizeOf(reply)-1);
  313. Move(UnitReplyBuffer[1],UnitReplyBuffer[2],SizeOf(reply)-1);
  314. serverInfo:=reply;
  315. With serverinfo
  316. do begin
  317.    connectionsMax  :=Swap(connectionsMax);   { force lo-hi again }
  318.    ConnectionsInUse:=Swap(connectionsInUse);
  319.    MaxConnVol      :=Swap(maxConnVol);
  320.    peak_conn_used  :=Swap(peak_conn_used);
  321.    for t:=48 downto 1
  322.     do if serverInfo.serverName[t]=#0 then serverInfo.serverName[0]:=chr(t-1);
  323.    end;
  324. GetServerInformation:=(result=0);
  325. End;
  326.  
  327.  
  328.  
  329. {F217/C9 [2.15c+]}
  330. FUNCTION GetFileServerDescriptionStrings(Var companyName,
  331.                                              VersionAndRevision,revisionDate,
  332.                                              copyrightNotice:String
  333.                                          ):Boolean;
  334. {SeeAlso: GetFileServerLoginStatus, GetServerInformation. }
  335. Var  x,xofs : word;
  336.      request : record
  337.                len : word;
  338.                subf: byte;
  339.                end         ABSOLUTE UnitReqBuffer;
  340.      reply : record
  341.              stuff : array [1..512] of byte;
  342.              end           ABSOLUTE UnitReplyBuffer;
  343. begin
  344. With request
  345. do begin
  346.    len  := 1;
  347.    subf := $c9;
  348.    end;
  349. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  350. companyName:=''; VersionAndRevision:='';
  351. revisionDate:=''; copyrightNotice:='';
  352. if result=$00
  353. then begin
  354.  
  355.      x:=1;xofs:=x;
  356.      while (reply.stuff[x]<>$00) and (x<512) do inc(x);
  357.      ZStrCopy(companyName,reply.stuff[xofs],x-xofs);
  358.  
  359.      inc(x);xofs:=x; { skip 1 zero. ? skip more zero's? }
  360.      While (reply.stuff[x]<>$00) and (x<512) do inc(x);
  361.      ZStrCopy(VersionAndRevision,reply.stuff[xofs],x-xofs);
  362.  
  363.      inc(x);xofs:=x;
  364.      While (reply.stuff[x]<>$00) and (x<512) do inc(x);
  365.      ZStrCopy(revisionDate,reply.stuff[xofs],x-xofs); { mm/dd/yy }
  366.  
  367.      inc(x);xofs:=x;
  368.      While (reply.stuff[x]<>$00) and (x<512) do inc(x);
  369.      ZStrCopy(copyrightNotice,reply.stuff[xofs],x-xofs);
  370.      end;
  371.  
  372. GetFileServerDescriptionStrings:=(Result=$00);
  373. end;
  374.  
  375.  
  376.  
  377. {F217/D3 [2.15c+]}
  378. FUNCTION DownFileServer (ForceFlag : Boolean) : Boolean;
  379. Var request : record
  380.               len : word;
  381.               subf: byte;
  382.               down_flag : byte;
  383.               end           ABSOLUTE UnitReqBuffer;
  384. BEGIN
  385. With request
  386. do begin
  387.    len  := 2;
  388.    subf := $D3;
  389.    if ForceFlag then down_flag := $01
  390.                 else down_flag := $00;
  391.    end;
  392. F2SystemCall($17,SizeOf(request),0);
  393. DownFileServer:=(result=0);
  394. { resultcodes: 00=successful; C6 No Console Rights ; FF Open Files}
  395. end;
  396.  
  397.  
  398. {F217/CF [3.x]}
  399. FUNCTION DisableTransactionTracking : Boolean;
  400. { Caller must have console-operator rights. }
  401. Var request : record
  402.               len : word;
  403.               subf: byte
  404.               end         ABSOLUTE UnitReqBuffer;
  405. BEGIN
  406. With request
  407. do begin
  408.    len := 1;
  409.    subf:= $CF;
  410.    end;
  411. F2SystemCall($17,SizeOf(request),0);
  412. DisableTransactionTracking:=(result=0);
  413. { resultcodes: 00=successful; C6 No Console Rights }
  414. end;
  415.  
  416.  
  417. {F217/D0 [3.x]}
  418. FUNCTION EnableTransactionTracking : Boolean;
  419. { Caller must have console-operator rights. }
  420. Var request : record
  421.               len : word;
  422.               subf: byte
  423.               end         ABSOLUTE UnitReqBuffer;
  424. BEGIN
  425. With request
  426. do begin
  427.    len := 1;
  428.    subf:= $D0;
  429.    end;
  430. F2SystemCall($17,SizeOf(request),0);
  431. EnableTransactionTracking:=(result=0);
  432. { resultcodes: 00=successful; C6 No Console Rights }
  433. end;
  434.  
  435.  
  436. {F217/CB [2.15c+]}
  437. FUNCTION DisableFileServerLogin : Boolean;
  438. { Caller must have console-operator rights. }
  439. Var request : record
  440.               len : word;
  441.               subf: byte
  442.               end        ABSOLUTE UnitReqBuffer;
  443. BEGIN
  444. With request
  445. do begin
  446.    len := 1;
  447.    subf:= $CB;
  448.    end;
  449. F2SystemCall($17,SizeOf(request),0);
  450. DisableFileServerLogin:=(result=0);
  451. { resultcodes: 00=successful; C6 No Console Rights }
  452. end;
  453.  
  454.  
  455.  
  456. {F217/CC [2.15c+]}
  457. FUNCTION EnableFileServerLogin : Boolean;
  458. { Caller needs console-operator rights. }
  459. Var request : record
  460.               len : word;
  461.               subf: byte
  462.               end         ABSOLUTE UnitReqBuffer;
  463. BEGIN
  464. With request
  465. do begin
  466.    len := 1;
  467.    subf:= $CC;
  468.    end;
  469. F2SystemCall($17,SizeOf(request),0);
  470. EnableFileServerLogin:=(result=0);
  471. { resultcodes: 00=successful; C6 No Console Rights }
  472. end;
  473.  
  474.  
  475.  
  476. {F217/CD [2.15c+]}
  477. FUNCTION GetFileServerLoginStatus( Var LoginEnabled:Boolean ): Boolean;
  478. { if Login is enabled then returns TRUE in LoginEnabled }
  479. { result byte:  00h  - Success, C6h No Console Rights }
  480. { Caller must have operator status.}
  481. Var Reply  : record
  482.              Flag    : Byte;
  483.              end            ABSOLUTE UnitReplyBuffer;
  484.    Request : record
  485.              Len     : Word;
  486.              SubF    : Byte;
  487.              end            ABSOLUTE UnitReqBuffer;
  488. begin
  489. with Request
  490. do begin
  491.    Len     := 1;
  492.    SubF    := $CD;
  493.    end;
  494. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  495. LoginEnabled:=Boolean(Reply.Flag);
  496. GetFileServerLoginStatus := (result=0);
  497. end;
  498.  
  499.  
  500. {F217/C8 [2.15c+]}
  501. FUNCTION CheckConsolePrivileges : Boolean;
  502. Var Request : record
  503.               Len  : Word;
  504.               SubF : Byte;
  505.               end         ABSOLUTE UnitReqBuffer;
  506. begin
  507. with Request
  508. do begin
  509.    Len  := 1;
  510.    SubF := $C8;
  511.    end;
  512. F2SystemCall($17,SizeOf(request),0);
  513. CheckConsolePrivileges := (Result=$00);
  514. { result byte:  00h  - Success, C6h No Console Rights }
  515. end;
  516.  
  517.  
  518. {F217/E6 [3.x]}
  519. FUNCTION GetBinderyObjectDiskSpaceLeft
  520.             ( ObjID : longInt;
  521.              var SystemElapsedTime,UnusedDiskBlocks : longint;
  522.              var RestrictionEnforced : Boolean             ) : Boolean;
  523. { Caller needs console-operator rights. }
  524. Var Request : record
  525.               Len   : Word;
  526.               SubF  : Byte;
  527.               _objID: Longint; {hi-lo}
  528.               end               ABSOLUTE UnitReqBuffer;
  529.     Reply   : record
  530.               _SysElapTime: Longint; {hi-lo} { ticks since system-up }
  531.               _objId      : Longint; {hi-lo}
  532.               _UnUsedDBl  : Longint; {hi-lo}
  533.               _RestrEnforced:Byte;
  534.               end               ABSOLUTE UnitReplyBuffer;
  535. begin
  536. with Request
  537. do begin
  538.    Len  := SizeOf(Request)-2;
  539.    SubF := $E6;
  540.    _objId:=Lswap(objID); {force hi-lo}
  541.    end;
  542. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  543. if result=$00
  544. then with reply
  545.      do begin
  546.         systemElapsedTime:=Lswap(_sysElapTime); {force lo-hi}
  547.         UnusedDiskBlocks :=Lswap(_UnUsedDBl);   {force lo-hi}
  548.         RestrictionEnforced:=(_RestrEnforced=$00); {00 enforced, FF not enforced }
  549.         end;
  550. if request._objId<>reply._objId then result:=$101;
  551.  
  552. GetBinderyObjectDiskSpaceLeft:=(Result=0);
  553. { Resultcodes: 00: successful; C6 No Console Rights }
  554. end;
  555.  
  556.  
  557. {F217/DB [2.15c+]}
  558. FUNCTION GetConnectionsOpenFiles
  559.            ( ConnID,ConnNumber  : Byte;
  560.      {i/o:}  var LastRecordSeen : word;
  561.      {out:}  var FileInfo: TfileInfoRecord ) : Boolean;
  562.  
  563. { the calling workstation must have console operator privileges }
  564. { LastRecordSeen is an i/o parameter;
  565.   -An initial value of 0 has to be supplied;
  566.   -The function can be called until LastRecordSeen becomes 0,
  567.    indicating the end of the FIR-list.
  568.  
  569.   to be called iteratively. }
  570.  
  571. Type Barr=array[1..14] of byte;
  572. Var Req: record
  573.          len:word;
  574.          subf:byte;
  575.          logicalConnNbr:word; {hi-lo}
  576.          lastRecSeen:word; {hi-lo, $0000 on first call }
  577.          end                 ABSOLUTE UnitReqBuffer;
  578.     Reply: record
  579.            nextReqRec : word; { hi-lo, use as lastRecSeen in next iterative call }
  580.                               { $0000 if no more records }
  581.            RecCount   : byte;
  582.            FileInfoRec: TfileInfoRecord;
  583.            fill:array[1..10] of byte;
  584.            end               ABSOLUTE UnitReplyBuffer;
  585.     resConnID:Byte;
  586.  
  587. { normally a great number of File Information Records can be returned by one call.
  588.   We have changed the function so that it returns one FIR per call. }
  589.  
  590. begin
  591. { !! set server with connID as preferred server !  }
  592. GetPreferredConnectionID(resConnID);
  593. SetPreferredConnectionID(connID);
  594.  
  595. With req
  596. do begin
  597.    len:=sizeof(req)-2;
  598.    subf:=$DB;
  599.    logicalConnNbr:=swap(connNumber); { force hi-lo }
  600.    lastRecSeen:=swap(LastRecordSeen); { force hi-lo }
  601.    end;
  602. F2SystemCall($17,SizeOf(req),SizeOf(reply));
  603. if result=$00
  604. then begin
  605.      if reply.recCount<>1
  606.      then result:=$101
  607.      else begin
  608.           LastRecordSeen:=swap(reply.NextReqRec); { force lo-hi }
  609.           FileInfo:=Reply.FileInfoRec;
  610.           fileinfo.DirEntry:=swap(fileinfo.DirEntry); { force lo-hi again }
  611.           ZstrCopy(fileInfo.filename,Barr(reply.FileInfoRec.filename),14);
  612.           end;
  613.      end;
  614.  
  615. { !! reset old preferred server ! }
  616. SetPreferredConnectionID(resConnID);
  617.  
  618. GetConnectionsOpenFiles:=(result=$00);
  619. { errorcodes: $00 Success; $C6 no console privileges }
  620. end;
  621.  
  622.  
  623. {F216/1A [2.x/3.x]}
  624. FUNCTION GetPathFromDirectoryEntry( connID:word;
  625.                                     volNbr:Byte; dirEntry:word;
  626.                                 Var Path:String                ):Boolean;
  627. {To be used in conjunction with the GetConnectionsOpenFiles func.
  628.  SeeAlso: GetConnectionsOpenFiles,
  629.           GetDirectoryPath (nwDir),GetVolumeName (nwDir).}
  630. Var Req: record
  631.          len:word;
  632.          subf:byte;
  633.          _volNbr:byte;
  634.          _dirEntry:word; {hi-lo}
  635.          end                ABSOLUTE UnitReqBuffer;
  636.     Reply: record
  637.            _Path:array[1..256] of byte;
  638.            end              ABSOLUTE UnitReplyBuffer;
  639.     resConnID:Byte;
  640. begin
  641. { !! set server with connID as preferred server !  }
  642. GetPreferredConnectionID(resConnID);
  643. SetPreferredConnectionID(connID);
  644.  
  645. With req
  646. do begin
  647.    len:=sizeof(req)-2;
  648.    subf:=$1A;
  649.    _volNbr:=volNbr;
  650.    _dirEntry:=swap(dirEntry); { force hi-lo }
  651.    end;
  652. F2SystemCall($16,SizeOf(req),SizeOf(reply));
  653. if result=$00
  654. then ZstrCopy(Path,reply._path,255)
  655. else path:='';
  656.  
  657. { !! reset old preferred server ! }
  658. SetPreferredConnectionID(resConnID);
  659.  
  660. GetPathFromDirectoryEntry:=(result=$00);
  661. { errorcodes: $00 Success; $C6 no console privileges }
  662. end;
  663.  
  664.  
  665. {F217/0E 2.15c+}
  666. FUNCTION GetDiskUtilization(volNbr:byte; objID:Longint;
  667.                         Var usedDirs,usedFiles,usedBlocks:Word ):Boolean;
  668. { SeeAlso: GetServerInformation,getBinderyObjectDiskSpaceLeft }
  669. Var Reply   : record
  670.               _volNbr:Byte;
  671.               _objID:Longint; {hi-lo}
  672.               _usedDirs,_usedFiles,_usedBlocks:Word; { all hi-lo }
  673.               end           ABSOLUTE UnitReplyBuffer;
  674.     Request : record
  675.               Len  : Word;
  676.               SubF : Byte;
  677.               _volNbr:Byte;
  678.               _objID:longInt; { hi-lo }
  679.               end           ABSOLUTE UnitReqBuffer;
  680. begin
  681. with Request
  682. do begin
  683.    Len  := SizeOf(Request)-2;
  684.    SubF := $0E;
  685.    _volNbr:=volNbr;
  686.    _objID:=Lswap(objID);
  687.    end;
  688. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  689. if result=$00
  690. then begin
  691.      with Reply
  692.      do begin
  693.         usedDirs:=swap(_usedDirs);    { force lo-hi }
  694.         usedFiles:=swap(_usedFiles);  { force lo-hi }
  695.         usedBlocks:=swap(_usedBlocks);{ force lo-hi }
  696.         end;
  697.      end;
  698. GetDiskUtilization:=(result=$00);
  699. {Resultcodes: 00h successful; 98h volume dosn't exist
  700.              F2h no Object read privileges }
  701. end;
  702.  
  703.  
  704. {F217/12 [2.15c+]}
  705. Function GetNetworkSerialNumber(Var serialNbr:LongInt; Var ApplicNbr:Word ):Boolean;
  706. {return the serial number and application number for the software
  707.       installed on the file server}
  708. {SeeAlso: VerifyNetworkSerialNumber,GetServerInformation}
  709. Var Reply  : record
  710.              _serNbr   : LongInt; {hi-lo}
  711.              _applicNbr: Word;    {hi-lo}
  712.              end                  ABSOLUTE UnitReplyBuffer;
  713.    Request : record
  714.              Len     : Word;
  715.              SubF    : Byte;
  716.              end                  ABSOLUTE UnitReqBuffer;
  717. begin
  718. with Request
  719. do begin
  720.    Len     := 1;
  721.    SubF    := $12;
  722.    end;
  723. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  724. with reply
  725. do begin
  726.    ApplicNbr:=swap(_applicNbr);   { force lo-hi }
  727.    serialNbr:=Lswap(_serNbr);     { force lo-hi }
  728.    end;
  729. GetNetworkSerialNumber := (result=0);
  730. end;
  731.  
  732.  
  733.  
  734. {F217/OC [2.15c+]}
  735. Function VerifyNetworkSerialNumber(serialNbr: LongInt ;
  736.                                Var ApplicNbr: Word     ):Boolean;
  737. {if the network serial number to be verified is correct, the reply
  738.       buffer will contain the corresponding application number }
  739. {SeeAlso: GetNetworkSerialNumber}
  740. Var Reply  : record
  741.              _applicNbr: word; {hi-lo}
  742.              end                ABSOLUTE UnitReplyBuffer;
  743.    Request : record
  744.              Len        : Word;
  745.              SubF       : Byte;
  746.              _netwSerNbr: LongInt; {hi-lo}
  747.              end                ABSOLUTE UnitReqBuffer;
  748. begin
  749. with Request
  750. do begin
  751.    Len     := 1;
  752.    SubF    := $0C;
  753.    _netwSerNbr:=Lswap(serialNbr);
  754.    end;
  755. F2SystemCall($17,SizeOf(request),SizeOf(reply));
  756. with reply
  757. do begin
  758.    ApplicNbr:=swap(_applicNbr); { force lo-hi }
  759.    end;
  760. VerifyNetworkSerialNumber := (result=0);
  761. end;
  762.  
  763.  
  764. {****************** secondary functions ************************************}
  765.  
  766.  
  767. {OLD E3 Call, used by CheckNetwareVersion}
  768. Function GetE3ServerInformation (Var serverInfo:TserverInfo):boolean;
  769. Var  Reg            : Registers;
  770.      RequestBuffer  : Record
  771.                       PacketLength : Integer;
  772.                       FunctionVal  : Byte;
  773.                       End;
  774.      Replylength:word ABSOLUTE serverInfo;
  775.      t:byte;
  776. Begin
  777. With RequestBuffer
  778. Do Begin
  779.    PacketLength := 1;
  780.    FunctionVal := $11;
  781.    End;
  782. ReplyLength := $80;
  783. With Reg
  784. Do Begin
  785.    Ah := $e3;
  786.    Ds := Seg(RequestBuffer);
  787.    Si := Ofs(RequestBuffer);
  788.    Es := Seg(ServerInfo);
  789.    Di := Ofs(ServerInfo);
  790.    End;
  791. MsDos(Reg);
  792. result:=reg.AL;
  793. GetE3ServerInformation:=(result=0);
  794. End;
  795.  
  796.  
  797. FUNCTION CheckNetwareVersion(MinimumVersion,MinimumSubVersion,
  798.                              MinimumRevision,MinimumSFT,MinimumTTS:word):Boolean;
  799. { checks if the current OS/TTS/SFT version is greater or equal to the minimal version }
  800. Var info:TserverInfo;
  801.     res:boolean;
  802. begin
  803. IF GetServerInformation(info) OR GetE3ServerInformation(info)
  804. then begin
  805.      IF (info.NetwareVersion>MinimumVersion)
  806.        then res:=true
  807.        else if (info.NetwareVersion=MinimumVersion)
  808.                AND (info.NetwareSubVersion>MinimumSubVersion)
  809.             then res:=true
  810.             else if (info.NetwareVersion=MinimumVersion)
  811.                     AND (info.NetwareSubVersion=MinimumSubVersion)
  812.                     AND (info.OS_Revision>=MinimumRevision)
  813.                  then res:=true
  814.                  else res:=false
  815.      end
  816. else res:=false;
  817.  
  818. CheckNetwareVersion:=res AND (info.SFT_Level>=MinimumSFT)
  819.                          AND (info.TTS_Level>=MinimumTTS)
  820. end;
  821.  
  822.  
  823. end. {unit nwServ}